#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
char s[50]="I like C++,,,  programming!";
int isBD(char c){
   if(c==','||c=='.'||c=='?'||c==' '||c=='!')
	   return 1; 
   else
	   return 0;
}
int main()
{
	char t=0;
	int i=0;
	while(s[i]!='\0')
	{
		while(isBD(s[i])==1&&s[i]!='\0')
		{
			cout<<s[i];	
			i++;
		}
		int si=i;
		while(isBD(s[i])==0&&s[i]!='\0')
		    i++;
		int ei=i-1;
		int m=si,n=ei;
		while(m<n)
		{
			char t=s[m];
			s[m]=s[n];
			s[n]=t;
			m++;
			n--;
		}
		for(int j=si;j<=ei;j++)
		   cout<<s[j];
		cout<<endl;
	}
	return 0;
}
